package com.unidt.www.module.third.doc.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.unidt.www.framework.mybatis.core.mapper.BaseMapperX;
import com.unidt.www.module.third.doc.domain.ProjectPlanDo;
import org.apache.ibatis.annotations.Mapper;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface ProjectPlanMapper  extends BaseMapperX<ProjectPlanDo> {


    default  List<ProjectPlanDo> getPlansByBusId(Long projectBusId){
        LambdaQueryWrapper<ProjectPlanDo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ProjectPlanDo::getProjectBusId,projectBusId);
        return  this.selectList(lambdaQueryWrapper);
    };

    default  List<ProjectPlanDo> getPlansByBusIds(List<Long> projectBusIds){
        if(projectBusIds.isEmpty())
        {
            return new ArrayList<>();
        }
        LambdaQueryWrapper<ProjectPlanDo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.in(ProjectPlanDo::getProjectBusId,projectBusIds);
        lambdaQueryWrapper.orderByAsc(ProjectPlanDo::getId);
        return  this.selectList(lambdaQueryWrapper);
    };
}
